<?php 
if (AJAX && !PJAX) {
    $this->renderHeadscripts('view');
    $this->renderView();
    exit;
}
ob_start();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <?php 
        if (!PJAX) {
            // jQuery Plugins
            $this->includeJS('jquery.js');
    //        $this->linkJS('http://code.jquery.com/jquery-migrate-1.2.1.min.js'); // Migration tests to jQuery 1.10
            $this->includeJS('pjax.js'); // Ajax Page Loading

            // XenonPHP Javascript Libs
            $this->includeJS('xenon.js');
    //        $this->includeJS('tools.js');
    //        $this->includeJS('benchmark.js');
    //        $this->includeJS('resize.js');
    //        $this->includeJS('ajax.js');
    //        $this->includeJS('ajaxUpload.js');
    //        $this->includePlugin('lightbox');

            $this->includeCSS('style.css');
            $this->includeJS('script.js');

            $this->renderHeadscripts(0);
        }
        
        
        ?>

    </head>
    <body>
<?php ob_start(); // Body Output Buffer for PJAX Support ?>
        <title><?php echo $this->pageTitle;?></title>
        
        <?php 
        $this->renderHeadscripts('plugins');
        $this->renderHeadscripts('body');
        $this->renderHeadscripts('view');
        ?>
        
        <div class="header">
            <!-- Header -->
            <div class="logo"></div>
            <div class="nav">
                <a class="<?php if (CONTROLLER == 'index')   echo ' active ';?>" href="index">Home</a>
                <a class="<?php if (CONTROLLER == 'contact') echo ' active ';?>" href="contact">Contact</a>

            </div>
        </div>

        <div id="content">
            <!-- Content -->
            <?php $this->renderView();?>
            
        </div>

        <div class="footer">
            <!-- Footer -->
            
        </div>
        
        <?php $this->renderHeadscripts('footer');?>
        
        <script type="text/javascript">
            $('a').pjax('body'); // Ajax Page Loading

        </script>
        <?php $body = ob_get_flush();?>

    </body>
</html>


<?php $html = ob_get_clean();
if (PJAX) echo $body; else echo $html;
